package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum CouponStatus {
	WAIT(0,"待使用"),
	USED(1,"已使用"),
	EXPIRED(2,"已过期");
	
	private Integer value;
	private String text;
	
	private CouponStatus(Integer value,String text){
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static CouponStatus toStatus(Integer value) {
		if (WAIT.value == value) {
			return WAIT;
		} else if (USED.value == value) {
			return USED;
		} else if (EXPIRED.value == value) {
			return EXPIRED;
		}else {
			throw new InvalidArgumentException("Unknown OrderStatus[" + value + "].");
		}
	}
	
}
